This invention relates to a method of operating a computer system, and in particular to a method of providing backup copies of data stored in a storage device to guard against the possibility of the storage device becoming faulty or the data becoming corrupted, lost or, more recently, "infected by a computer virus". The invention is especially concerned with the provision of backups for personal computers (P.C.s).
Conventionally, in a simple, single user computer system comprising storage means such as a hard or fixed disk, only one application program has access to the storage means at any given time. The task of backing up data stored by the storage means is carried out by an application program which will have exclusive use of the storage means while carrying out the backup operation, since in such an environment no other application can operate until the backup application terminates.
With the introduction of multi-tasking environments which allow several applications to operate simultaneously, and of network systems, which allow several users to share the same resources, a situation may arise where more than one application has concurrent access to the same storage means. When this situation arises, there is a possibility of conflict between the applications. For example, one application might modify or delete a file currently being used by another application. This would lead to confusion and potentially to corruption of the storage means and consequently to loss of data.
Methods known as "file locking" and "record locking" have been introduced into operating systems to avoid, in the case of file locking, more than one application writing to a file or, in the case of record locking, two applications modifying the same area of a given file. These methods are sophisticated enough for most applications, particularly if each application only makes relatively minor changes to files which are shared and therefore does not significantly delay other applications wishing to access a file or record that is locked. However, an application for periodically backing up data in a computer system where the storage means are shared, is a special case.
The smallest unit of data that can be backed up is a single file, since neither the backup application nor the operating system has knowledge of the internal structure of a file because it could be associated with any application program.
In addition, the backup copy of the file needs to be an exact image of the original at a particular point in time. Copying a file is, however, not an instantaneous process and the time taken to copy will depend on the size of the file and the speed of the copying operation. This leads to a problem unless the backup application can be sure that no other application can modify the file during the copying process.
To copy a file, a backup application allocates an area of random access memory (RAM) as a transfer buffer and proceeds by alternately reading blocks of the source file into the buffer and then writing the buffer contents out to a secondary storage means. Unless the file is very small, the transfer buffer will fill up several times and the copying operation will require several read and write operations to make a complete copy of the file.
The potential problem caused by allowing the file to be modified during the copying process, may be illustrated by considering the example of a file which is being copied as a series of 10 blocks. If the file were to be modified by a transaction that required changes to the file which corresponded to blocks 3 and 8 after blocks 1 to 5 had already been copied, the copying process would subsequently copy the change to block 8 but would not copy the change to block 3 since this block had already been copied before the transaction occurred. The backup copy will therefore contain only a partial transaction which may make the backup copy entirely useless, since the application that "owns" it will probably consider the file to be corrupt.
U.S. Pat. No. 5,086,502 discloses a method of backing up each write operation as it is made by making a duplicate write operation to a secondary storage means. In addition to this method, there are two other ways of backing up files on a computer system having shared storage means:
i) Lock the file whilst backing up. This prevents other users from modifying the file by denying them write access. If another user already has write access, the backup application must either skip that file or wait until exclusive write access can be obtained. PA1 ii) Detect modifications to the file. After copying the file, the backup application can use the operating system to check if any modifications were made during the copy operation. If modifications were made, then the copy must be repeated or that file skipped.
Neither of the latter two methods provides an adequate solution since many files (particularly database files) are constantly in use. Furthermore, the two methods require users to be effectively locked out while the backup takes place. Additionally, few secondary storage devices and operating system combinations are capable of sustained transfer rates of more than 15 megabytes (Mb) per minute and therefore the time taken to copy a large file is significant.
A few application programs do address the problem by providing methods of safely backing up their own files in a shared environment, but the procedure for each is different. To backup the whole storage means, the backup application therefore needs to know how each different built-in procedure works or must rely on manual intervention at an appropriate point.
Thus, since a backup application must backup a whole file and since this must not be modified by another application program during the backup process, the use of prior backup methods will introduce delays into a computer system having shared storage means. This is particularly true while large files are backed up.